package com.changli01.create.thread.runnable;
class printEven implements Runnable {
    @Override
    public void run() {
        for(int i = 1;i<=100;i++){
            if ((i&1) == 1){
                System.out.println(Thread.currentThread().getName()+":" +i);
            }
        }
    }
}
public class EvenTest {
    public static void main(String[] args) {
        printEven p1 = new printEven();
        Thread t1 = new Thread(p1);
        t1.start();
//        main() 主线程
        for(int i = 1;i<=100;i++){
            if ((i&1) == 1){
                System.out.println(Thread.currentThread().getName()+":" +i);
            }
        }
        //匿名接口实现匿名类对象
        new Thread(new Runnable() {
            @Override
            public void run() {
                for(int i = 1;i<=100;i++){
                    if ((i&1) == 1){
                        System.out.println(Thread.currentThread().getName()+":" +i);
                    }
                }
            }
        }){

        }.start();

    }
}
